import Vue from 'vue';
import VueRouter from  'vue-router'

Vue.use(VueRouter)
const router = new VueRouter({
  routes: [
    {
      path: '/',
      name: 'Home',
      redirect: '/login'
    },
    {
      path: '/layout',
      name: 'Layout',
      component: () => import('../views/Layout.vue'),
      children: [
        {
          path: '/layout/article',
          name: 'Article',
          component: () => import('../views/Article.vue')
        },
        {
          path: '/layout/collect',
          name: 'Collect',
          component: () => import('../views/Collect.vue')
        },
        {
          path: '/layout/like',
          name: 'Like',
          component: () => import('../views/Like.vue')
        },
        {
          path: '/layout/user',
          name: 'User',
          component: () => import('../views/User.vue')
        }
      ]
    },
    {
      path: '/detail/:id?',
      name: 'Detail',
      component: () => import('../views/Detail.vue')
    },
    {
      path: '/register',
      name: 'Register',
      component: () => import('../views/Register.vue')
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('../views/Login.vue')
    },
  ],
  // mode: 'history',
  linkActiveClass: 'active',
  linkExactActiveClass: 'ex-active'
})

export default router